package com.sfdk.admin.data
{
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import flash.events.IEventDispatcher;
	import flash.geom.Rectangle;
	
	import mx.binding.utils.BindingUtils;

	public class RectangleEx extends Rectangle implements IEventDispatcher
	{
		private var _eventDispatcher : EventDispatcher;
		
		public function RectangleEx(x : Number = 0, y : Number = 0, width : Number = 0, height : Number = 0)
		{
			super(x,y,width,height);
			_eventDispatcher = new EventDispatcher(this);
		}
		
		public function set xEx(value : Number) : void
		{
			super.x = value;			
			dispatchEvent(new Event(Event.CHANGE));
		}
		
		[Bindable]
		public function get xEx() : Number
		{
			return super.x;
		}
		
		public function set yEx(value : Number) :void
		{
			super.y = value;
			dispatchEvent(new Event(Event.CHANGE));
		}
		
		[Bindable]
		public function get yEx() : Number
		{
			return super.y;
		}
		
		public function set widthEx(value : Number) :void
		{
			super.width = value;
			dispatchEvent(new Event(Event.CHANGE));
		}
		
		[Bindable]
		public function get widthEx() : Number
		{
			return super.width;
		}
		
		public function set heightEx(value : Number) :void
		{
			super.height = value;
			dispatchEvent(new Event(Event.CHANGE));
		}
		
		[Bindable]
		public function get heightEx() : Number
		{
			return super.height;
		}
		
		public function addEventListener(type : String, listener : Function, useCapture : Boolean = false, priority : int = 0, useWeakReference : Boolean = false) : void
		{
			_eventDispatcher.addEventListener(type, listener, useCapture, priority, useWeakReference);
		}
		
		public function hasEventListener(type : String) : Boolean
		{
			return _eventDispatcher.hasEventListener(type);
		}
		
		public function dispatchEvent(event : Event) : Boolean
		{
			return _eventDispatcher.dispatchEvent(event);
		}
		
		public function removeEventListener(type : String, listener : Function, useCapture : Boolean = false) : void
		{
			_eventDispatcher.removeEventListener(type, listener, useCapture);
		}
		
		public function willTrigger(type : String) : Boolean
		{
			return _eventDispatcher.willTrigger(type);
		}
	}
}